package common

import "regexp"

// 正则验证
func Verify(s string, t string) bool {
	test := ``
	switch t {
	case "username":
		test = `^\w{5,16}$`
	case "password":
		test = `^\w{6,16}$`
	case "mobile":
		test = `^1[35789]\d{9}$`
	case "email":
		test = `^\w+@\w+[.](com|cn)$`
	}
	r, _ := regexp.MatchString(test, s)
	return r
}
